/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arg.deploy.webapp.user.ctrl;

import com.arg.deploy.bean.User;
import com.arg.deploy.common.ConvertFormatUtil;
import com.arg.deploy.webapp.common.DeployCheckboxRenderer;
import java.util.Locale;
import org.zkoss.zul.Checkbox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Row;

/**
 *
 * @author sorasaks
 */
public class AddUserRenderer extends DeployCheckboxRenderer {

    private Locale locale;

    public AddUserRenderer(Locale locale) {
        this.locale = locale;
    }

    @Override
    protected void gridRender(Row row, Object o, int i) throws Exception {
        User user = (User) o;

        appendCellInRow(row, createLabelInCell(String.valueOf(i + 1), CENTER_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(user.getUsername(), CENTER_CELL_STYLE));
        appendCellInRow(row, createLabelInCell(ConvertFormatUtil.convertFormat(user.getCreateDate(), ConvertFormatUtil.DEFAULT_FULL_DATE_FORMAT, locale), CENTER_CELL_STYLE));

        addListRow(row);
    }
}
